#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
bool Match(char a, char b) {
    int c = a - b;
    if (c == 'A'-'a' || c == 'a'-'A') {
        return true;
    }
    return false;
}

/**
 * 整理字符串
 * 
 */
int main() {
    std::string str;
    std::cin >> str;

    std::stack<char> s;

    for(int i=0; i < str.size(); i++) {
        char c = str[i];

        if (!s.empty()) {
            char top = s.top();
            if (Match(c, top)) {
                s.pop();
            }else {
                s.push(c);
            }
        }else {
            s.push(c);
        }

    }

    if (s.empty()) {
        std::cout << "";
    }else {
        std::string result;
        while(!s.empty()) {
            result += s.top();
            s.pop();
        }
        std::reverse(result.begin(), result.end());
        std::cout << result;
    }

    return 0;
}